/* @(#)GSOrderCancelConfirmAction.java    
 *
 * Project: BUS
 *
 * Modify Information:
 * =============================================================================
 *   Author       Date       Description
 *   ------------ ---------- ---------------------------------------------------
 *   RoadZheng     2006-2-17    建立
 *
 * Copyright Notice:
 * =============================================================================
 *    Copyright (c) 2001-2006 Beijing HiTRUST Technology Co., Ltd. 1808 Room, 
 *        Science & Technology Building, No. 9 South Street, Zhong Guan Cun, 
 *        Haidian District, Beijing ,100081, China All rights reserved.
 *
 *    This software is the confidential and proprietary information of
 *        Beijing HiTRUST Technology Co., Ltd. ("Confidential Information").
 *        You shall not disclose such Confidential Information and shall use it
 *        only in accordance with the terms of the license agreement you entered
 *        into with HiTRUST.
 *
 * Warning:
 * =============================================================================
 * 
 */
package com.hitrust.gs.action;

import com.hitrust.gs.bean.GSOperatorBean;
import com.hitrust.gs.bean.GSOrderBean;
import com.hitrust.gs.business.GSOrderProcessor;
import com.hitrust.gs.dao.GSOperatorDAO;
import com.hitrust.gs.dao.GSOrderDAO;
import com.hitrust.gs.form.GSOrderCancelConfirmForm;
import com.hitrust.gs.lib.GSBaseConstants;
import com.hitrust.gs.lib.GSLogWriter;
import com.hitrust.gs.service.GSBaseAction;
import com.hitrust.gs.service.GSBaseForm;
import com.hitrust.gs.util.exception.GSException;

public class GSOrderCancelConfirmAction extends GSBaseAction {

	public String execute(GSBaseForm aForm) throws Exception {
		GSOrderCancelConfirmForm tForm = (GSOrderCancelConfirmForm)aForm;
		//获取操作员信息
		GSOperatorBean tGSOperatorBean = (GSOperatorBean)tForm.getSession().getAttribute(GSBaseConstants.LOGIN);
		GSOperatorDAO tGSOperatorDAO = new GSOperatorDAO();
		tGSOperatorBean = tGSOperatorDAO.queryOperById(tGSOperatorBean.getGs_oper_id());
		//获取订单基本信息
		GSOrderDAO tGSOrderDAO = new GSOrderDAO();
		GSOrderBean tGSOrderBean = tGSOrderDAO.getOrderByTempID(tForm.getOrder_tempid());
		//取消订单
		GSOrderProcessor tGSOrderProcessor = new GSOrderProcessor();
		tForm.getRequest().setAttribute("action","A100601");
		try{
			tGSOrderProcessor.orderCancel(tGSOperatorBean,tGSOrderBean);
			tForm.getRequest().setAttribute("message","订单取消操作执行成功!");
			GSLogWriter.error(tGSOperatorBean.getGs_oper_id() + " 订单取消成功." );
	        return GSBaseConstants.FORWARD_SUCCESS;
	    }
	    catch(GSException e){	    	
			GSLogWriter.error(this, e.getMessage());
			aForm.getRequest().setAttribute("exception_code", e.getCode());
			aForm.getRequest().setAttribute("exception_desc", e.getMessage());
			GSLogWriter.error(tGSOperatorBean.getGs_oper_id() + " 订单取消失败." );
			return GSBaseConstants.FORWARD_ERROR;	        
	    }
	}

}
